#ifndef __SVUV_HPP__
#define __SVUV_HPP__

#include "tcpclient.hpp"
#include "tcpserver.hpp"

class svuv
{
private:
/*******************************************************Global*******************************************************************************************/
    uv_loop_t gloop;

/*******************************************************TCP Client***************************************************************************************/
    std::vector<class tcpclient *> gtcpClientVec;

/*******************************************************TCP Server***************************************************************************************/
    class tcpserver *gtcpServer;
public:
    svuv(/* args */);
    ~svuv();

    void gStartLoop();

/*******************************************************TCP Client***************************************************************************************/
public:    
    int32_t gaddTcpClient(std::string server_ip, uint16_t server_port, std::string local_ip, uint16_t local_port);
    int32_t gTcpClientSend(std::string local_ip, uint16_t local_port, uint8_t *sdata, int32_t sdata_len);
    int32_t gTcpClientRecv(std::string local_ip, uint16_t local_port, uint8_t *buff, int32_t buff_len);
    bool gTcpClientGetConnectStatus(std::string local_ip, uint16_t local_port);


/*******************************************************TCP Server***************************************************************************************/
    int32_t gaddTcpServer(std::string server_ip, uint16_t server_port);
    int32_t gTcpServerRecv(std::string client_ip, uint16_t client_port, uint8_t *buff, int32_t buff_len);
    int32_t gTcpServerSend(std::string client_ip, uint16_t client_port, uint8_t *sdata, int32_t sdata_len);
    int32_t gTcpServerGetRemainSpace(std::string client_ip, uint16_t client_port);
};




#endif